package com.jiazhong.构造方法;

public class Demo03 {
    public static void main(String[] args) {
        Person3 ps1=new Person3();
        System.out.println("name:"+ps1.name+"  age"+ps1.age);
        ps1=new Person3("张三");
        System.out.println("name:"+ps1.name+"  age"+ps1.age);
        Person3 ps3=new Person3("李四",250);
        System.out.println("name:"+ps3.name+"  age"+ps3.age);

    }
}
class Person3{
    String name;
    int age;

    public Person3() {
        age=18;
    }

    public Person3(String name) {
        this.name = name;
    }

    public Person3(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
